﻿Imports System.Drawing

Public Class EventProvider

    Public Event ColorEvent(ByVal sender As Object, ByVal e As EventProviderEventArgs)

    Private Function RandomColor() As System.Drawing.Color
        Dim ran = New Random()
        Dim names As KnownColor() = DirectCast([Enum].GetValues(GetType(KnownColor)), KnownColor())
        Dim randomColorName As KnownColor = names(ran.[Next](names.Length))
        Return Color.FromKnownColor(randomColorName)
    End Function

    Public Sub Start()
        RaiseEvent ColorEvent(Me, New EventProviderEventArgs(setColor:=RandomColor()))
    End Sub



End Class
